<template>

  <data-table
    ref="pagingTable"
    :options="options"
    :list-query="listQuery"
  >
    <template #filter-content>

      <dic-list-select v-model="listQuery.params.handState" title="交卷状态" dic-code="paper_hand_state" class="filter-item"/>
      <dic-list-select v-model="listQuery.params.reviewState" title="阅卷状态" dic-code="paper_review_state" class="filter-item"/>
      <dic-list-select v-model="listQuery.params.exState" title="异常状态" dic-code="paper_ex_state" class="filter-item"/>
      <el-input v-model="listQuery.params.realName" placeholder="搜索人员" class="filter-item" size="small" style="width: 200px" />

    </template>

    <template #data-columns>

      <el-table-column
        label="人员"
        align="center"
      >

        <template v-slot="scope">
          {{ scope.row.userId_dictText }}
        </template>

      </el-table-column>

      <el-table-column
        show-overflow-tooltip
        label="考试时间"
        align="center"
        prop="createTime"
      />

      <el-table-column
        label="考试时长(分钟)"
        align="center"
        prop="totalTime"
      >

        <template v-slot="scope">
          {{ scope.row.userTime }} / {{ scope.row.totalTime }}
        </template>

      </el-table-column>

      <el-table-column
        label="学员主观分"
        align="center"
        prop="userSubjScore"
      />

      <el-table-column
        label="学员客观分"
        align="center"
        prop="userObjScore"
      />

      <el-table-column
        label="学员总分"
        align="center"
        prop="userScore"
      />

      <el-table-column
        label="及格分"
        align="center"
        prop="qualifyScore"
      />

      <el-table-column
        label="试卷总分"
        align="center"
        prop="totalScore"
      />

      <el-table-column
        label="阅卷状态"
        align="center"
      >

        <template v-slot="scope">
          {{ scope.row.reviewState_dictText }}
        </template>

      </el-table-column>

      <el-table-column
        label="阅卷人"
        align="center"
        prop="reviewUser_dictText"
      />

      <el-table-column
        show-overflow-tooltip
        label="异常状态"
        align="center"
        prop="exState_dictText"
      />

      <el-table-column
        label="操作"
        align="center"
      >
        <template v-slot="scope">

          <router-link :to="{ name: 'ReviewPaperDetail', params: { paperId: scope.row.id }}">
            <el-link type="primary" icon="el-icon-finished">查看&批阅</el-link>
          </router-link>

        </template>

      </el-table-column>

    </template>

  </data-table>

</template>

<script>
import DataTable from '@/components/DataTable'
import DicListSelect from '@/components/DicListSelect/index.vue'

export default {
  name: 'QuList',
  components: { DicListSelect, DataTable },
  data() {
    return {

      listQuery: {
        current: 1,
        size: 10,
        params: {
          title: '',
          examId: '',
          handState: '1',
          reviewState: '0',
          exState: ''
        }
      },

      options: {

        // 可批量操作
        multi: false,
        // 列表请求URL
        listUrl: '/api/paper/paper/paging'
      }
    }
  },
  created() {
    this.listQuery.params.examId = this.$route.params.examId
  },
  methods: {

    handleReview(id) {
      this.$router.push({ name: 'ReviewPaperDetail', params: { paperId: id }})
    },

    handleView(id) {
      this.$router.push({ name: 'ShowExam', params: { id: id }})
    }
  }
}
</script>
